package io.gitee.zhangbinhub.admin.oauth.bus.publish

import io.gitee.zhangbinhub.admin.common.event.CloudBusEventContent
import io.gitee.zhangbinhub.admin.common.event.ReloadDataBusEvent
import io.gitee.zhangbinhub.admin.oauth.constant.BusEventMessage
import org.noear.solon.annotation.Component
import org.noear.solon.cloud.CloudClient

/**
 * @since JDK 11
 */
@Component
class ReloadDataEventPublish {
    fun doNotifyRefreshApplication() {
        ReloadDataBusEvent(CloudBusEventContent(message = BusEventMessage.refreshApplication)).apply {
            CloudClient.event().publish(this.toEvent())
        }
    }

    fun doNotifyRefreshRuntime() {
        ReloadDataBusEvent(CloudBusEventContent(message = BusEventMessage.refreshRuntime)).apply {
            CloudClient.event().publish(this.toEvent())
        }
    }
}
